﻿<shared:PageBase x:Class="Miris.HumanMilkAnalyser.WPF.PatientQuickSearchPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:shared="clr-namespace:Miris.HumanMilkAnalyser.WPF.Shared"
      xmlns:userControl="clr-namespace:Miris.HumanMilkAnalyser.WPF.CustomizedUserControl"
      x:Name="CurrentPage"
      mc:Ignorable="d" 
      d:DesignHeight="580" d:DesignWidth="1160"
	  Title="PatientQuickSearchPage" Style="{StaticResource DefaultPageStyle}" 
      DataContext="{Binding PatientQuickSearch, Source={StaticResource Locator}}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Skins/Storyboard/PageStoryborad.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Grid HorizontalAlignment="Center">
        <Grid.ColumnDefinitions>
            <!-- Back Button -->
            <ColumnDefinition Width="Auto" />
            <!-- Main Content -->
            <ColumnDefinition Width="Auto" />
            <!-- Next Button -->
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Button Margin="0,0,30,0" Width="47" Tag="/Skins/Resource/Image/Back.png" Style="{StaticResource OpacityImageButton}" Click="ButtonBack_Click" />
        <!-- Trasparent effect Background -->
        <Border Grid.Column="1" Style="{StaticResource PageContentContainerBorder}">
            <Border Style="{StaticResource PageContentBackgroundBorder}" />
        </Border>
        <Grid Grid.Column="1" Width="1050" Height="550">
            <Grid.RowDefinitions>
                <!-- Page Title -->
                <RowDefinition Height="55" />
                <!-- Patient Info -->
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock Text="病人信息快速查找" Margin="0,15,40,0" HorizontalAlignment="Center" Style="{StaticResource PageTitleTextBlock}" />
            <Grid Grid.Row="1" Margin="20,0,20,0">
                <Grid.RowDefinitions>
                    <!-- Search Condition -->
                    <RowDefinition Height="Auto" />
                    <!-- Patient Data -->
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <!-- Label -->
                        <ColumnDefinition Width="Auto" />
                        <!-- Input -->
                        <ColumnDefinition />
                        <!-- Label -->
                        <ColumnDefinition Width="Auto" />
                        <!-- Input -->
                        <ColumnDefinition />
                        <!-- Label -->
                        <ColumnDefinition Width="Auto" />
                        <!-- Input -->
                        <ColumnDefinition Width="Auto" />
                        <!-- Search Button -->
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="受测者ID：" VerticalAlignment="Center" Style="{StaticResource WhiteTextBlock}" />
                    <TextBox Grid.Column="1" HorizontalAlignment="Left" Text="{Binding PatientNumber}" Width="160" Height="36" Style="{StaticResource InfoTextBox}" />
                    <TextBlock Grid.Column="2" Text="母亲姓名：" VerticalAlignment="Center" Style="{StaticResource WhiteTextBlock}" />
                    <TextBox Grid.Column="3" HorizontalAlignment="Left" Text="{Binding MotherName}" Width="160" Height="36" Style="{StaticResource InfoTextBox}" />
                    <TextBlock Grid.Column="4" Text="婴儿姓名：" VerticalAlignment="Center" Style="{StaticResource WhiteTextBlock}" />
                    <TextBox Grid.Column="5" HorizontalAlignment="Left" Text="{Binding BabyName}" Width="160" Height="36" Style="{StaticResource InfoTextBox}" />
                    <Button Grid.Column="6" Width="35" Margin="0,0,12,0" Tag="/Skins/Resource/Image/Search.png" 
                                Style="{StaticResource OpacityImageButton}" HorizontalAlignment="Right" ToolTip="检索"
                                Command="{Binding SearchCommand}" />
                </Grid>
                <DataGrid x:Name="DataGridPatients" Grid.Row="1" Margin="0,10,10,0" SelectionMode="Single"
                              SelectedItem="{Binding SelectedPatient, Mode=OneWayToSource, UpdateSourceTrigger=PropertyChanged}" 
                              ColumnHeaderStyle="{StaticResource DefaultDataGridColumnHeader}"
                              ItemsSource="{Binding PatientList}">
                    <DataGrid.Resources>
                        <SolidColorBrush Color="LightBlue" x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" />
                    </DataGrid.Resources>
                    <DataGrid.Columns>
                        <DataGridTextColumn Width="80" Header="顺序号" Binding="{Binding SequenceNumber}" />
                        <DataGridTextColumn Width="*" Header="受测者ID" Binding="{Binding PatientNumber}" />
                        <DataGridTextColumn Width="120" Header="母亲姓名" Binding="{Binding MotherName}" />
                        <DataGridTextColumn Width="120" Header="婴儿姓名" Binding="{Binding BabyName}" />
                        <DataGridTextColumn Width="160" Header="上次测试时间" Binding="{Binding LastTestDateDisplay}" />
                        <DataGridTextColumn Width="120" Header="测试次数" Binding="{Binding TestCount}" />
                    </DataGrid.Columns>
                </DataGrid>
            </Grid>
        </Grid>
        <Button Grid.Column="2" Margin="30,0,0,0" Width="47" Tag="/Skins/Resource/Image/Next.png" Command="{Binding NextCommand}" Style="{StaticResource OpacityImageButton}" />
    </Grid>
</shared:PageBase>
